package com.example.priorityqueue;

import java.time.LocalDate;
import java.util.PriorityQueue;

public class Main {
    public static void main(String[] args) {
        var pq = new PriorityQueue<LocalDate>();
        pq.add(LocalDate.of(1908, 12, 9));
        pq.add(LocalDate.of(1815, 9, 7));
        pq.add(LocalDate.of(2021, 8, 8));

        System.out.println("迭代遍历优先队列（无序）");
        for(LocalDate date : pq){
            System.out.println(date);
        }
        System.out.println("删除元素（有序）");
        while(!pq.isEmpty()){
            System.out.println(pq.remove());
        }
    }
}
